<template>
	<div class="invo-page">
        <div class="nav-back" @click="goBack">
            <i class="el-icon-arrow-left"></i>
        </div>
		<div class="invo-box">
			<h1 class="marg-B3 t-cen">密码修改</h1>
            <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="密码设置:">
                    <el-input v-model="form.password"></el-input>
                </el-form-item>
                <el-form-item label="重复密码:">
                    <el-input v-model="form.password_confirm"></el-input>
                </el-form-item>
                <div class="btn-box t-cen">
					<el-button class="btn b-bg" type="primary" @click="handleSure">保存</el-button>
				</div>
            </el-form>
		</div>
	</div>
</template>

<script>
    import {request} from "@/assets/js/utils/request"
    import mixin from '@/assets/js/mixin'
	export default {
        mixins: [mixin],
        data() {
            return {
                form : {
                    password: '',
                    password_confirm: ''
                }
            }
        },
        methods: {
            handleSure() {
                request({
                    url: `/user/password`,
                    method: 'POST',
                    data: {
                        password: this.form.password,
                        password_confirm: this.form.password_confirm
                    }
                }).then(res => {
                    if(res.code == 200) {
                        this.$message({
                            message: '修改成功',
                            type: 'success'
                        });
                        this.$router.push('/login')
                    } else {
                        this.$message.error(res.message);
                    }
                })
            }
        }
    }
</script>

<style lang="less" scoped>
	.invo-page{
		width: 100%;
        padding: 20px;
		border-radius: 8px;
		background: #fff;
		.invo-box{
            width: 300px;
            margin: 50px auto;
			border-radius: 8rpx;
			padding: 20rpx;
			.title{
				font-size: 32rpx;
				color: rgba(56, 56, 56, 1);
			}
			.btn-box{
                .btn{
                    font-size: 14px;
                    padding: 0;
                    color: #fff;
                    width: 100%;
                    height: 40px;
                    text-align: center;
                    line-height: 40px;
                    border-radius: 25px;
                }
                .b-bg{
                    background: #2967E3;
                }
                .l-bg{
                    background: #00BAAD;
                }
                .gray{
                    background: #A6A6A6;
                }
            }
		}
	}
	
</style>